<?php
/*--------------------------------------------------------------------------------------------------
    update_whos_online_table.php 2022-11-23
    Gambio GmbH
    http://www.gambio.de
    Copyright (c) 2022 Gambio GmbH
    Released under the GNU General Public License (Version 2)
    [http://www.gnu.org/licenses/gpl-2.0.html]
    --------------------------------------------------------------------------------------------------
 */

/** @var DatabaseModel $this */
/** @var int $t_success */

if (!$this->columnExists('whos_online', 'is_bot')) {
    $t_success &= $this->query("ALTER TABLE `whos_online` ADD `is_bot` TINYINT(1) NOT NULL DEFAULT '0' AFTER `last_page_url`;");
}

if (!$this->indexExists('whos_online', 'INDEX', ['is_bot'])) {
    $t_success &= $this->set_index('whos_online', 'INDEX', ['is_bot'], 'is_bot');
}

if (!$this->columnExists('whos_online', 'whos_online_id')) {
    $t_success &= $this->query("ALTER TABLE `whos_online` ADD `whos_online_id` INT(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (`whos_online_id`);");
}
